package com.ehui.test.ehuitest.test;

import com.luhui.ehui.anno.ExcelMapping;
import com.luhui.ehui.anno.FieldMapping;
import com.luhui.ehui.entitiyFactory.SpringEntityFactory;
import com.luhui.ehui.exception.EhuiInitException;
import com.luhui.ehui.reflect.Excel;
import com.luhui.ehui.reflect.ReflectAgent;
import com.luhui.ehui.reflect.ReflectException;
import com.luhui.ehui.util.ProcessHandler;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Scope;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.stereotype.Repository;

import java.io.FileNotFoundException;
import java.lang.reflect.Field;

/**
 * Created with LXD
 *
 * @author:Luhui
 * @qq:729913162
 * @Date:2018-09-06
 * @Time:22:40
 */
@Repository
@ExcelMapping(value = "1营销健康.csv",rowStart = 1)
@Scope("prototype")
public class Health extends Excel implements ProcessHandler {
    @FieldMapping("a")
    private String medium;
    @FieldMapping("b")
    private String level4;

    public String getMedium() {
        return medium;
    }

    public void setMedium(String medium) {
        this.medium = medium;
    }

    public String getLevel4() {
        return level4;
    }

    public void setLevel4(String level4) {
        this.level4 = level4;
    }

    @Override
    public boolean process() {
        System.out.println(this);
        return false;
    }

    @Override
    public void destroy() {

    }

    @Override
    public String toString() {
        return "Health{" +
                "medium='" + medium + '\'' +
                ", level4='" + level4 + '\'' +
                '}';
    }

    public static void main(String[] args) throws FileNotFoundException, ReflectException, EhuiInitException, NoSuchFieldException, IllegalAccessException {
        ReflectAgent.getAll2(Health.class,"D:\\新表\\");
//        Health instance = new SpringEntityFactory().getInstance(Health.class);

//        System.out.println(instance);
    }
}
